package org.levi.demo.mybatis.plugin.plugins;

import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.plugin.*;

import java.sql.Statement;
import java.util.Properties;
@Intercepts({
        @Signature(type = StatementHandler.class,method = "update",args = {Statement.class})
})
public class MyFirstPlugin implements Interceptor {


    public Object intercept(Invocation invocation) throws Throwable {
        System.out.println("================>>>>>>>>>>>>>>对方法进行了增强<<<<<<<<<<<<<<<<<<===========");
        return invocation.proceed();
    }

    public Object plugin(Object o) {

        System.out.println("================>>>>>>>>>>>>>>挂载当前增强<<<<<<<<<<<<<<<<<<===========");
        return Plugin.wrap(o,this);
    }

    public void setProperties(Properties properties) {
        System.out.println("================>>>>>>>>>>>>>>获取properties配置<<<<<<<<<<<<<<<<<<===========");
        properties.list(System.out);
    }
}
